/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.pdx.cs.guavadata.data;

import edu.pdx.cs.guavadata.condition.ColumnReference;
import java.util.Date;
import java.util.UUID;

/**
 *
 * @author VuTran
 */
public class Common {
    public static String wrap(Object o) {
        if (o instanceof ColumnReference)
            return ((ColumnReference) o).columnAlias;

        if (o instanceof String) return "'" + o.toString() + "'";
        if (o instanceof UUID) return "'" + o.toString() + "'";
        if (o instanceof Date) return "'" + o.toString() + "'";
        if (o == null) return "NULL";
        if (o instanceof Boolean) {
            return o.equals(true) ? "1" : "0";
        }

        return "" + o.toString() + "";
    }
}
